#include "functions.h"
#include <chrono>

using namespace std;
int main()
{
  typedef std::chrono::high_resolution_clock myclock;
  int n = 50;
  double** A = new double*[n];
  for(int i = 0; i < n; i++)
    {
      A[i] = new double[n]();
    }
  A[0][0] = 6.0;
  A[0][1] = 1.0;
  for(int i = 1; i < n; i++)
    {
      A[i][i-1] = 8.0;
      A[i][i] = 6.0;
      A[i][i+1] = 1.0;
    }
  A[n-1][n-2] = 8.0;
  A[n-1][n-1] = 6.0;
  double* b = new double[n];
  b[0] = 7.0;
  b[n-1] = 14.0;
  for(int i = 1; i < n-1; i++)
  b[i] = 15.0;
  myclock::time_point beginning_I1 = myclock::now();
  LS_QR_Householder(A, b, n, n);
  myclock::duration d_I1 = myclock::now() - beginning_I1;
  cout << "(1)I.Time of QR:" << d_I1.count() << endl;
  for(int i = 0; i < n; i++)
     cout << "x[" << i << "] = " << b[i] << endl;
  for(int i = 0; i < n; i++)
    {
      delete[] A[i];
    }
  delete [] A;
  delete [] b;

  return 0;
};
